package javaservicesmanager;

import swings.labels.LimpidLabel;
import swings.others.CommonScrollPane;
import swings.panels.RecordPanel;
import swings.panels.ToolBarPanel;
import swings.panels.WorkPanel;
import utils.CommonUtils;
import utils.ImageUtils;

import javax.swing.*;
import java.io.IOException;
import java.sql.SQLException;

/**
 * @version V1.0
 * @Title: AESPostman主类
 * @Package
 * @Description: 绘制AESPostman窗口
 * @author: GaleBlade
 * @date:
 */
public class JavaServicesManager extends JFrame {

    private static JFrame main = new JFrame("JavaServicesManager");

    /**
     * 构造方法
     */
    public JavaServicesManager() throws IOException, SQLException, ClassNotFoundException {
        JPanel contentPane = (JPanel) main.getContentPane();
        contentPane.setOpaque(false);
        contentPane.setLayout(null);
        //初始化工作区
        WorkPanel workPanel = new WorkPanel();
        //初始化记录列表区
        RecordPanel recordPanel = new RecordPanel(workPanel);
        //初始化工具栏
        ToolBarPanel toolBarPanel = new ToolBarPanel(recordPanel);
        //初始化列表区的滚动条
        CommonScrollPane jspRecord = new CommonScrollPane(RecordPanel.x, RecordPanel.y, RecordPanel.width, RecordPanel.height);
        jspRecord.getViewport().add(recordPanel);
        //把组件添加到容器
        contentPane.add(toolBarPanel);
        contentPane.add(jspRecord);
        contentPane.add(workPanel);
        contentPane.add(ToolBarPanel.bg);
        contentPane.add(RecordPanel.bg);
        contentPane.add(WorkPanel.bg);
        //初始化图形界面
        main.setSize(1200, 800);
        main.setLocation((CommonUtils.screenWidth -1200)/2, (CommonUtils.screenHeight-800)/2);
        //添加背景
        main.add(new LimpidLabel(ImageUtils.bg,0, 0, 1200, 800));
        //设置图标
        main.setIconImage(ImageUtils.logo);
        main.setDefaultCloseOperation(EXIT_ON_CLOSE);
        main.setVisible(true);
        main.repaint();
    }

}
